import { defHttp } from '/@/utils/http/axios';
import { ContentTypeEnum } from '/@/enums/httpEnum';

enum Api {
  getoauthTokenList = '/admin-api/system/oauth2-token/page',
  getoauthTokenDelete = '/admin-api/system/oauth2-token/delete',
  getoauthlcientpage = '/admin-api/system/oauth2-client/page',
  getoauthlcient = '/admin-api/system/oauth2-client/get',
  editoauthlcient = '/admin-api/system/oauth2-client/update',
  addoauthlcient = '/admin-api/system/oauth2-client/create',
  deleteoauthlcient = '/admin-api/system/oauth2-client/delete',
}

/**
 * @description: 获token列表
 */
export const oauthTokenList = (params: any) => {
  return defHttp.get<any>({ url: Api.getoauthTokenList, params });
};
export const deleteoauthToken = (params: any) => {
  return defHttp.delete<any>({
    url: Api.getoauthTokenDelete,
    params,
    headers: { 'Content-Type': ContentTypeEnum.FORM_URLENCODED },
  });
};
export const getoauthClientPage = (params: any) => {
  return defHttp.get<any>({ url: Api.getoauthlcientpage, params });
};
export const getoauthlcient = (params: any) => {
  return defHttp.get<any>({ url: Api.getoauthlcient, params });
};
export const addoauthClient = (params: any) => {
  return defHttp.post<any>({ url: Api.addoauthlcient, params });
};
export const editoauthClient = (params: any) => {
  return defHttp.put<any>({ url: Api.editoauthlcient, params });
};
export const deleteoauthClient = (params: any) => {
  return defHttp.delete<any>(
    {
      url: Api.deleteoauthlcient,
      params,
      headers: { 'Content-Type': ContentTypeEnum.FORM_URLENCODED },
    },
    { joinParamsToUrl: true },
  );
};
